GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Branch master (8f2e94)
by Joss
01:13
created

grid.js ➔ describe(ꞌGridꞌ)   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 45

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 45
rs 8.8571
c 1
b 0
f 0
1
'use strict';
2
3
var expect = require('expect.js');
4
var Grid = require('../lib/grid');
5
var Position = require('../lib/position');
6
7
describe('Grid', function() {
8
    describe('setItemPosition', function () {
9
        var grid = new Grid(new Position({x:5,y:5}, 'N'));
10
        it('should add a position to occupation object', function () {
11
            var position = new Position({x:1,y:1}, 'N');
12
            grid.setItemPosition(0, position);
13
            expect(grid.occupation[0]).to.equal(position);
14
        });
15
        it('should update an item’s position in occupation object', function () {
16
            var position = new Position({x:2,y:2}, 'S');
17
            grid.setItemPosition(0, position);
18
            expect(grid.occupation[0]).to.equal(position);
19
        });
20
    });
21
    describe('getCellOccupation', function () {
22
        var grid = new Grid(new Position({x:5,y:5}, 'N')),
23
            itemPosition = new Position({x:4,y:4}, 'N');
24
        grid.setItemPosition(0, itemPosition); // set a test item
25
        it('should return ’id’ of item who match an occupied cell', function () {
26
            var position = new Position({x:4,y:4}, 'N');
27
            expect(grid.getCellOccupation(position)).to.equal(0);
28
        });
29
        it('should return ’null’ if no item has been found for the given cell', function () {
30
            var position = new Position({x:3,y:3}, 'N');
31
            expect(grid.getCellOccupation(position)).to.equal(null);
32
        });
33
        it('should throw an error when position is not valid', function () {
34
            expect(function() {
35
                grid.getCellOccupation(false);
36
            }).to.throwException(/Position is not valid/);
37
        });
38
    });
39
    describe('isValid', function () {
40
        it('should throw an error when X is not valid', function () {
41
            expect(function() {
42
                new Grid({x:false,y:5});
43
            }).to.throwException(/Coordinates are not valid/);
44
        });
45
        it('should throw an error when Y is not valid', function () {
46
            expect(function() {
47
                new Grid({x:5,y:false});
48
            }).to.throwException(/Coordinates are not valid/);
49
        });
50
    });
51
});